package ae.pcfc.cldos.online.common.clddb.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.envers.RevisionEntity;
import org.hibernate.envers.RevisionNumber;
import org.hibernate.envers.RevisionTimestamp;

import ae.pcfc.cldos.online.common.clddb.revision.listener.CustomRevisionListener;

/**
 * 
 * @author arosa
 *
 */
@Entity
@RevisionEntity(CustomRevisionListener.class)
@Table(name="REVINFO")
@SequenceGenerator(name = "SQ_CLDOS_REV", sequenceName = "SQ_CLDOS_REV", initialValue = 1, allocationSize = 1)
public class CustomRevisionEntity implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -7501958281827171295L;

	private String username;
	private int id;
	private long timestamp;
	
	@Column(name="USERNAME")
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	@RevisionTimestamp
	@Column(name="REVTSTMP")
	public long getTimestamp() {
		return timestamp;
	}
	
	@Id
	@GeneratedValue( strategy = GenerationType.SEQUENCE, generator="SQ_CLDOS_REV")
	@RevisionNumber
	@Column(name="REV")
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}
}
